import { Body, ClassSerializerInterceptor, Controller, Get, Post, Query, UseInterceptors } from '@nestjs/common';
import { UserService } from './user.service';

@Controller('user')
export class UserController {
  constructor(private readonly userService: UserService) { }

  @Post("create")
  create(@Body() data) {
    return this.userService.create(data)
  }

  @Post("update")
  update(@Body() data) {
    return this.userService.update(data)
  }

  @Get()
  queryAll() {
    return this.userService.queryAll()
  }

  @Get("remove")
  remove(@Query() data) {
    console.log(data);

    return this.userService.remove(data)
  }

  @UseInterceptors(ClassSerializerInterceptor)
  @Post("register")
  register(@Body() data) {
    return this.userService.register(data)
  }

  @Post("update-role")
  updateUserRole(@Body() data) {
    return this.userService.updateUserRole(data)
  }

}
